package org.kailu.book.service;

import java.util.List;

import org.kailu.book.DAO.DepartmentDAO;
import org.kailu.book.entity.DepartmentEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class DepartmentService {

	@Autowired
	private DepartmentDAO departmentDAO;
	
	@Transactional
	public void save(DepartmentEntity departmentEntity) {
		this.departmentDAO.save(departmentEntity);
	}
	
	@Transactional
	public List<DepartmentEntity> getAll() {
		return this.departmentDAO.getAll();
	}
	
	@Transactional
	public DepartmentEntity get(int id) {
		return this.departmentDAO.getById(id);
	}
	
	@Transactional
	public void delete(int id) {
		this.departmentDAO.delete(id);
	}
	
}
